<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>layui</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="../../lib/layui-v2.5.5/css/layui.css" media="all">
    <link rel="stylesheet" href="../../css/public.css" media="all">
    <style>
        body {
            background-color: #ffffff;
        }
    </style>
</head>
<body>
<div class="layui-form layuimini-form" id="editUserData">
    <div class="layui-form-item" style="display: none;">
        <label class="layui-form-label">ID</label>
        <div class="layui-input-block">
            <input type="text" name="id" value="1">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label required">用户名称</label>
        <div class="layui-input-block">
            <input type="text" name="name" lay-verify="required" lay-reqtext="用户名称不能为空" placeholder="请输入用户名称" value="" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">性别</label>
        <div class="layui-input-block">
            <input type="radio" name="sex" value="male" title="男" checked="">
            <input type="radio" name="sex" value="female" title="女">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label required">年龄</label>
        <div class="layui-input-block">
            <input type="number" name="age" lay-verify="required" lay-reqtext="年龄不能为空" placeholder="请输入年龄" value="" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">身高</label>
        <div class="layui-input-block">
            <input type="number" name="height" lay-reqtext="身高" placeholder="请输入身高" value="" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">体重</label>
        <div class="layui-input-block">
            <input type="number" name="weight" lay-reqtext="体重" placeholder="请输入体重" value="" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">住址</label>
        <div class="layui-input-block">
            <input type="text" name="weight" lay-reqtext="住址" placeholder="请输入住址" value="" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">身份证</label>
        <div class="layui-input-block">
            <input type="text" name="id_number" lay-reqtext="身份证" placeholder="请输入身份证" value="" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">电话号码</label>
        <div class="layui-input-block">
            <input type="text" name="tel" placeholder="请输入电话号码" value="" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">文化程度</label>
        <div class="layui-input-block">
            <input type="text" name="edu_background" lay-reqtext="文化程度" placeholder="请输入文化程度" value="" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label required">是否指导员</label>
        <div class="layui-input-block">
            <input type="radio" name="is_instructor" value="true" title="是" checked="">
            <input type="radio" name="is_instructor" value="false" title="否">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label required">指导员等级</label>
        <div class="layui-input-inline">
            <select name="instructor_class" value="国家级" lay-search="" lay-verify="required">
                <option value="">请选择</option>
                <option value="国家级">国家级</option>
                <option value="一级">一级</option>
                <option value="二级">二级</option>
                <option value="三级">三级</option>
            </select>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label required">指导员类型</label>
        <div class="layui-input-inline">
            <select name="instructor_type" lay-search="" lay-verify="required">
                <option value="">请选择</option>
                <option value="篮球">篮球</option>
                <option value="足球">足球</option>
                <option value="羽毛球">羽毛球</option>
                <option value="乒乓球">乒乓球</option>
            </select>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">审核状态</label>
        <div class="layui-input-block">
            <input type="radio" name="ver_status" value="已审核" title="已审核" checked="">
            <input type="radio" name="ver_status" value="未审核" title="未审核">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">证书编号</label>
        <div class="layui-input-block">
            <input type="text" name="certificate_num" placeholder="请输入证书编号" value="" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">发证日期</label>
        <div class="layui-input-block">
            <input class="layui-input" name="certificate_date" id="certificate_date" placeholder="请选择发证日期">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">健身地点</label>
        <div class="layui-input-block">
            <input type="text" name="gym" placeholder="请输入健身地点" value="" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">评定成绩</label>
        <div class="layui-input-block">
            <input type="text" name="assessment" placeholder="请输入评定成绩" value="" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label required">年检日期</label>
        <div class="layui-input-block">
            <input class="layui-input" name="annual_survey_date" lay-verify="required" lay-reqtext="年检日期不允许为空" id="annual_survey_date" placeholder="请选择年检日期">
        </div>
    </div>
    <div class="layui-form-item">
        <div class="layui-input-block">
            <button class="layui-btn" lay-submit lay-filter="saveBtn">确认保存</button>
        </div>
    </div>
</div>
</div>
<script src="../../lib/layui-v2.5.5/layui.js" charset="utf-8"></script>
<script src="../../js/lay-config.js?v=1.0.4" charset="utf-8"></script>
<script src="../../lib/js/config.js" charset="utf-8"></script>
<script>
    layui.use(['form', 'laydate', 'miniAdmin'], function () {
        var form = layui.form,
            $ = layui.jquery,
            laydate = layui.laydate,
            layer = layui.layer,
            miniAdmin = layui.miniAdmin,
            $ = layui.$;

        laydate.render({
            elem: '#certificate_date',
            type: 'date',
            format: 'yyyy-MM-dd',
        });
        laydate.render({
            elem: '#upload_time',
            type: 'date',
            format: 'yyyy-MM-dd',
        });
        laydate.render({
            elem: '#annual_survey_date',
            type: 'date',
            format: 'yyyy-MM-dd',
        });
        var editUserData = JSON.parse(localStorage.getItem("editUserData"));
        localStorage.removeItem("editUserData");
        Object.keys(editUserData).map(function (key) {
            $("[name='"+key+"']").val(editUserData[key]);
        });
        form.render();
        //监听提交
        form.on('submit(saveBtn)', function (data) {
            // data.field
            $.getJSON(userUpdateURL, data.field , function (data) {
                if (responseSuccess(miniAdmin, data) === "success") {
                    layer.msg("更新成功", {icon: 1, shade: this.shade, scrollbar: false, time: 3000, shadeClose: true});
                    // var iframeIndex = parent.layer.getFrameIndex(window.name);
                    // parent.layer.close(iframeIndex);
                }
            }).fail(function () {
                miniAdmin.error('服务内部错误');
            });

            return false;
        });

    });
</script>
</body>
</html>